<?php
//$viewName = Blyn::app()->getUIManager()->getActiveLink()->getLinkVariable('viewName');
$eventTable = new BAEventSheet();

$event1 = $eventTable->getList(array('itemData' => array('name' => 'newsList')));
$newsEventContentTable = new BAEventSheet($event1);
$newsList = $newsEventContentTable->getView();

$event2 = $eventTable->getList(array('itemData' => array('name' => 'trainList')));
$trainEventContentTable = new BAEventSheet($event2);
$trainList = $trainEventContentTable->getView();

$event3 = $eventTable->getList(array('itemData' => array('name' => 'gameList')));
$gameEventContentTable = new BAEventSheet($event3);
$gameList = $gameEventContentTable->getView();


$event4 = $eventTable->getList(array('itemData' => array('name' => 'activityList')));
$activityEventContentTable = new BAEventSheet($event4);
$activityList = $activityEventContentTable->getView();
?>
<html>
    <head>
        <title>冠者体育</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta charset="utf-8">

        <style type="text/css">
            #header{width: 100%;height: 50px;color: #FFF;background-color: #2BB2A3; font-size: 24px;font-weight: bolder;}
            #logo{margin-left:5px;margin-top:2px;height:35px;float:left}
            #refresh{margin-right:5px;margin-top:2px;height:35px;float:right;}
            #main{width: 99%;margin:1%;}
            #con{width:62%;float:left;margin-left: 1%}
            #honour{width:35%;float:right;margin-bottom:1%;margin-left:2%;}
            #introduce{width:35%;float:right;margin-bottom:1%;margin-left:2%;}
            /*#list0{height: 100px;width: 100%;background-image: url(<?php //echo Yii::app()->request->baseUrl . '/images/BWeEvent/images/xinwen.jpg';    ?>);background-repeat: no-repeat;background-size: 100% 100px;text-align: left;margin-top: 2px;}*/
            #shadow{background-color: black;opacity: 0.4;width: 100%;height: 30px;position: relative;top:100px;}

            #body2_4{display: none;margin-bottom: 10px;margin-left:0px;}
            #body2_3{display: none;margin-bottom: 10px;margin-left:0px}
            #body2_1 ul,#body2_3 ul,#body2_4 ul{padding: 5px 2px 0 2px;}
            #body2_1 {display: block;margin-bottom: 10px;}
            //  #body2_1 .item {width: 100%; padding: 5px 5px 0 5px;}
            #body2_1 .headlines {display:inline-block;color:white;font-size:20px;position:relative;top:90px;}

            #body2_2 ul{padding: 5px 2px 0 2px;}
            #body2_2 {display: none;margin-bottom: 10px;}
            #body2_2 .item {width: 100%; padding: 5px 5px 0 5px;}
            #body2_2 .headlines {display:inline-block;color:white;font-size:20px;position:relative;top:90px;}

            table.m{width: 100%;border-width: 0 1px 1px 1px;border-style: solid;border-color: #dedede;}
            div.wen{width: 70%;text-align: left;float: left;padding-left: 10px;padding-top: 5px}
            div.tu{margin-left: 10px; width: 30px;float: left;overflow: hidden;}
            img.M{width: 100%}
            img.N{width: 95%;margin-left: 1%;padding: 0 1px 0 1px;}
            #id ul li p{display: inline-block;}
            hr{width: 100%;border:1px solid #BCBCBC;}
        </style>
        <script type="text/javascript">
            $(document).ready(function() {
                $("#news").click(function() {
                    $("#body2_1").css("display", "block");
                    $("#body2_2").css("display", "none");
                    $("#body2_3").css("display", "none");
                    $("#body2_4").css("display", "none");
                    $("#body2_5").css("display", "none");
                })
                $("#saishi").click(function() {
                    $("#body2_1").css("display", "none");
                    $("#body2_2").css("display", "block");
                    $("#body2_3").css("display", "none");
                    $("#body2_4").css("display", "none");
                    $("#body2_5").css("display", "none");
                })
                $("#train").click(function() {
                    $("#body2_1").css("display", "none");
                    $("#body2_2").css("display", "none");
                    $("#body2_3").css("display", "block");
                    $("#body2_4").css("display", "none");
                    $("#body2_5").css("display", "none");
                })
                $("#activity").click(function() {
                    $("#body2_1").css("display", "none");
                    $("#body2_2").css("display", "none");
                    $("#body2_3").css("display", "none");
                    $("#body2_4").css("display", "block");
                    $("#body2_5").css("display", "none");
                })
                $("#huiyuan").click(function() {
                    $("#body2_1").css("display", "none");
                    $("#body2_2").css("display", "none");
                    $("#body2_3").css("display", "none");
                    $("#body2_4").css("display", "none");
                    $("#body2_5").css("display", "block");
                })
            })
        </script>
    </head>

    <body>
        <div id="header">
            <img id="logo" src="<?php echo Yii::app()->request->baseUrl . '/images/BWeEvent/images/logo.png'; ?>">冠者体育
            <img id="refresh"  src="<?php //echo Yii::app()->request->baseUrl . '/images/BWeEvent/images/refresh.png';     ?>">
        </div>

        <div id="main">
            <div id="con">
                <?php
                echo $control->getAjaxLink(array(
                    'name' => '<img class="M" src="' . Yii::app()->request->baseUrl . '/images/BWeEvent/images/display.jpg' . '"/>',
                    'id' => 'clubArticle'),
                        array(
                    'viewName' => 'clubArticle',
                    'htmlOptions' => array(
                        'enctype' => 'multipart/form-data'
                )));
                ?>
            </div>

            <div id="honour">
                <?php
                echo $control->getAjaxLink(array(
                    'name' => '<img class="M" src="' . Yii::app()->request->baseUrl . '/images/BWeEvent/images/honour.jpg' . '"/>',
                    'id' => 'honour'),
                        array(
                    'viewName' => 'honour',
                    'htmlOptions' => array(
                        'enctype' => 'multipart/form-data'
                )));
                ?>
            </div>
            <div id="introduce">
                <?php
                echo $control->getAjaxLink(array(
                    'name' => '<img class="M" src="' . Yii::app()->request->baseUrl . '/images/BWeEvent/images/introduce.jpg' . '"/>',
                    'id' => 'introduce'),
                        array(
                    'viewName' => 'introduce',
                    'htmlOptions' => array(
                        'enctype' => 'multipart/form-data'
                )));
                ?>
            </div>
            <div style="width:100%;height:0px;clear:both;"></div>
        </div>

        <div style="width:100%;height:15%;overflow-x:auto;">
            <table style="width:100%;height:100%">
                <tr>
                    <td><img id="news" class="N" src="<?php echo Yii::app()->request->baseUrl . '/images/BWeEvent/images/new.jpg'; ?>"></td>
                    <td><img id="saishi" class="N" src="<?php echo Yii::app()->request->baseUrl . '/images/BWeEvent/images/saishi.jpg'; ?>"></td>
                    <td><img id="train" class="N" src="<?php echo Yii::app()->request->baseUrl . '/images/BWeEvent/images/train.jpg'; ?>"></td>
                    <td><img id="activity" class="N" src="<?php echo Yii::app()->request->baseUrl . '/images/BWeEvent/images/activity.jpg'; ?>"></td>
                </tr>
            </table>
        </div>
        <!-- 新闻 -->
        <div id="body2_1">
            <div class="item">
                <?php
                if (isset($newsList))
                {
                    $i = 0;
                    foreach ($newsList as $content)
                    {
                        $newsTitle = $content->getItem('newsTitle')->getValue();
                        $author = $content->getItem('author')->getValue();
                        //  $cop = $content->getItem('cop')->getValue();
                        //  $time =$content->getItem('time')->getValue();
                        $info = $content->getItem('info')->getValue();
                        $image = $content->getItem('image')->getValue();
                        if ($i == 0)
                        {
                            $i++;
                            ?>
                            <div style="height: 150px;width: 100%;background-image: url(<?php echo Yii::app()->request->baseUrl . $image; ?>);background-repeat: no-repeat;background-size: 100% 100%;text-align: left;margin-top: 2px;">
                                <div id="shadow" style="position:relative;top:120px;"></div>
                                <?php
                                echo $control->getAjaxLink(array(
                                    'name' => "<p class='headlines'>[" . $newsTitle . "]</p>",
                                    'id' => 'newsArticle'),
                                        array(
                                    'viewName' => 'newsArticle',
                                    'newsTitle' => $newsTitle,
                                    'author' => $author,
                                    'info' => $info,
                                    'image' => substr($image, 8),
                                    'htmlOptions' => array(
                                        'enctype' => 'multipart/form-data'
                                )));
                                ?>
                            </div>

                            <?php
                        }
                        else
                        {
                            ?>
                            <table class="m">
                                <tr>
                                    <td style="width: 60px;"><img style="width:50px;height:50px;margin: 5px" src="<?php echo Yii::app()->request->baseUrl . $image; ?>"></td>
                                    <td>
                                        <?php
                                        echo $control->getAjaxLink(array(
                                            'name' => "$newsTitle<span>$author</span>",
                                            'id' => 'newsArticle'),
                                                array(
                                            'viewName' => 'newsArticle',
                                            'newsTitle' => $newsTitle,
                                            'author' => $author,
                                            'info' => $info,
                                            'image' =>  substr($image, 8),
                                            'htmlOptions' => array(
                                                'enctype' => 'multipart/form-data'
                                        )));
                                        echo "<br>" . " <span>$author</span>";
                                        ?>
                                    </td>
                                </tr>
                            </table>
                            <?php
                        }
                    }
                }
                ?>
            </div>
            <div class="grad-sep"></div>
        </div>
        <!-- 赛事 -->
        <div id="body2_2">
            <?php
            if (isset($gameList))
            {
                $i = 0;
                foreach ($gameList as $content)
                {
                    $themeName = $content->getItem('theme')->getValue();
                    $address = $content->getItem('address')->getValue();
                    $cop = $content->getItem('Cop')->getValue();
                    $time = $content->getItem('time')->getValue();
                    $info = $content->getItem('info')->getValue();
                    $image = $content->getItem('image')->getValue();
                    if ($i == 0)
                    {
                        $i++;
                        ?>
                        <div style="height: 150px;width: 100%;background-image: url(<?php echo Yii::app()->request->baseUrl . $image; ?>);background-repeat: no-repeat;background-size: 100% 100%;text-align: left;margin-top: 2px;">
                            <div id="shadow" style="position:relative;top:120px;"></div>
                            <?php
                            echo $control->getAjaxLink(array(
                                'name' => "<p class='headlines'>[" . $themeName . "]</p>",
                                'id' => 'newsArticle'),
                                    array(
                                'viewName' => 'newsArticle',
                                'newsTitle' => $themeName,
                                'author' => $cop,
                                'info' => $info,
                                 'image' =>  substr($image, 8),
                                'htmlOptions' => array(
                                    'enctype' => 'multipart/form-data'
                            )));
                            ?>
                        </div>
                        <?php
                    }
                    else
                    {
                        ?>

                        <table class="m">
                            <tr>
                                <td style="width: 60px;"><img style="width:50px;height:50px;margin: 5px" src="<?php echo Yii::app()->request->baseUrl . $image; ?>"></td>
                                <td>
                                    <?php
                                    echo $control->getAjaxLink(array(
                                        'name' => "<li style='list-style-type: none;'>$themeName</li>",
                                        'id' => 'newsArticle'),
                                            array(
                                        'viewName' => 'newsArticle',
                                        'newsTitle' => $themeName,
                                        'author' => $address,
                                        'info' => $info,
                                         'image' =>  substr($image, 8),
                                        'htmlOptions' => array(
                                            'enctype' => 'multipart/form-data'
                                    )));
                                    echo "<span>$time</span>";
                                    ?>
                                </td></tr>
                        </table>    
                        <?php
                    }
                }
            }
            ?> 

        </div> 
        <!-- 训练 -->
        <div id="body2_3">
            <div class="item">
                <ul>
                    <?php
                    if (isset($trainList))
                    {
                        $i = 0;
                        foreach ($trainList as $content)
                        {
                            $contentId = $content->getId();
                            $themeName = $content->getItem('theme')->getValue();
                            $address = $content->getItem('address')->getValue();
                            $cop = $content->getItem('Cop')->getValue();
                            $time = $content->getItem('time')->getValue();
                            $info = $content->getItem('info')->getValue();
                            $image = $content->getItem('image')->getValue();
                            if ($i == 0)
                            {
                                $i++;
                                ?>
                                <table>
                                    <tr>
                                        <td rowspan="2" style="padding-right: 12px;"><img src="<?php echo Yii::app()->request->baseUrl . $image; ?>" width="100px" height="100px"/></td>
                                        <td><h4>
                                                 <?php
                                    echo $control->getAjaxLink(array(
                                        'name' => "$themeName",
                                        'id' => 'newsArticle'),
                                            array(
                                        'viewName' => 'newsArticle',
                                        'newsTitle' => $themeName,
                                        'author' => $address,
                                        'info' => $info,
                                         'image' =>  substr($image, 8),
                                        'htmlOptions' => array(
                                            'enctype' => 'multipart/form-data'
                                    )));
                                    ?>
                                           </h4> <?php
                                            echo $control->getAjaxLink(array(
                                                'name' => "<span>个人报名</span>",
                                                'id' => 'join'),
                                                    array(
                                                'viewName' => 'join',
                                                'contentId' => $contentId,
                                                'infoId' => 0,
                                                'htmlOptions' => array(
                                                    'enctype' => 'multipart/form-data'
                                            )));

                                            echo " | ";
                                            echo $control->getAjaxLink(array(
                                                'name' => "<span>团队报名</span>",
                                                'id' => 'join'),
                                                    array(
                                                'viewName' => 'join_Team',
                                                'contentId' => $contentId,
                                                'infoId' => 0,
                                                'htmlOptions' => array(
                                                    'enctype' => 'multipart/form-data'
                                            )));
                                            ?></td>
                                    </tr>
                                    <tr>
                                        <td><?php echo $info; ?></td>
                                    </tr>
                                </table>
                                <?php
                            }
                            else
                            {
                                ?>
                                <table class="m">
                                    <tr>
                                        <td style="width: 60px;"><img style="width:50px;height:50px;margin: 5px" src="<?php echo Yii::app()->request->baseUrl . $image; ?>"></td>
                                        <td>    
                                            <?php
                                            echo $control->getAjaxLink(array(
                                                'name' => "<li style='list-style-type: none;'>$themeName</li>",
                                                'id' => 'newsArticle'),
                                                    array(
                                                'viewName' => 'newsArticle',
                                                'newsTitle' => $themeName,
                                                'author' => $address,
                                                'info' => $info,
                                                 'image' =>  substr($image, 8),
                                                'htmlOptions' => array(
                                                    'enctype' => 'multipart/form-data'
                                            )));

                                            echo $control->getAjaxLink(array(
                                                'name' => "<span>个人报名</span>",
                                                'id' => 'join'),
                                                    array(
                                                'viewName' => 'join',
                                                'contentId' => $contentId,
                                                'infoId' => 0,
                                                'htmlOptions' => array(
                                                    'enctype' => 'multipart/form-data'
                                            )));
                                            echo " | ";
                                            echo $control->getAjaxLink(array(
                                                'name' => "<span>团队报名</span>",
                                                'id' => 'join'),
                                                    array(
                                                'viewName' => 'join_Team',
                                                'contentId' => $contentId,
                                                'infoId' => 0,
                                                'htmlOptions' => array(
                                                    'enctype' => 'multipart/form-data'
                                            )));
                                            ?>
                                        </td></tr></table>

                                <?php
                            }
                        }
                    }
                    ?> 

                </ul>
                <div class="grad-sep"></div>
            </div>
        </div>

        <!-- 活动 -->
        <div id="body2_4">
            <div class="item">
                <ul>
                    <?php
                    if (isset($activityList))
                    {
                        $i = 0;
                        foreach ($activityList as $content)
                        {
                            $themeName = $content->getItem('theme')->getValue();
                            $address = $content->getItem('address')->getValue();
                            $cop = $content->getItem('Cop')->getValue();
                            $time = $content->getItem('time')->getValue();
                            $info = $content->getItem('info')->getValue();
                            $image = $content->getItem('image')->getValue();
                            if ($i == 0)
                            {
                                $i++;
                                ?>

                    <table>
                                    <tr>
                                        <td rowspan="2" style="padding-right: 12px;"><img src="<?php echo Yii::app()->request->baseUrl . $image; ?>" width="100px" height="100px"/></td>
                                        <td><h4>       <?php
                                    echo $control->getAjaxLink(array(
                                        'name' => "$themeName",
                                        'id' => 'newsArticle'),
                                            array(
                                        'viewName' => 'newsArticle',
                                        'newsTitle' => $themeName,
                                        'author' => $address,
                                        'info' => $info,
                                         'image' =>  substr($image, 8),
                                        'htmlOptions' => array(
                                            'enctype' => 'multipart/form-data'
                                    )));
                                   
                                    ?></h4><?php  echo "<span>$time</span>";?></td>
                                    </tr>
                                  
                                </table>
                                <?php
                            }
                            else
                            {
                                ?>
                                <table class="m">
                                    <tr>
                                        <td style="width: 60px;"><img style="width:50px;height:50px;margin: 5px" src="<?php echo Yii::app()->request->baseUrl . $image; ?>"></td>
                                        <td>   
                                            <?php
                                            echo $control->getAjaxLink(array(
                                                'name' => "<li style='list-style-type: none;'>$themeName</li>",
                                                'id' => 'newsArticle'),
                                                    array(
                                                'viewName' => 'newsArticle',
                                                'newsTitle' => $themeName,
                                                'author' => $address,
                                                'info' => $info,
                                                'image' =>  substr($image, 8),
                                                'htmlOptions' => array(
                                                    'enctype' => 'multipart/form-data'
                                            )));
                                            echo "<span>$time</span>";
                                            ?>
                                        </td></tr></table>
                                <?php
                            }
                        }
                    }
                    ?> 
                </ul>
                <div class="grad-sep"></div>
            </div> 
        </div>
    </body>
</html>